package edu.gdpu.complier;

/**
 * @author mazebin
 * @date 2021年 07月08日 22:37:16
 * JVM的执行模式默认为混合模式
 *<blockquote><pre>
 * C:\Users\poplar>java -version
 * java version "1.8.0_201"
 * Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
 * Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
 * </pre></blockquote>
 * -Xint 禁止编译执行
 * -Xcomp 强制虚拟机运行于“编译模式”
 * 启动JVM时加上-XX:+PrintCompilation参数能看到相关的信息。
 * 链接为https://blog.csdn.net/LYF0707/article/details/102032235
 */
public class JItAndInterpreterTest {
    public static void main(String[] args) {
        for (int i = 0; i < 10_0000; i++) {
            func();

        }
        long start = System.currentTimeMillis();
        for (int i = 0; i < 10_0000; i++) {
            func();
        }
        long end = System.currentTimeMillis();
        System.out.println(end-start);
    }
    public static void func(){
        for (int i = 0; i < 10_0000L; i++) {
            long j =i%3;
        }
    }
}
